{% extends 'generic.html' %}
{% load i18n %} {# Translating code #}

{% block cssBlock %}        
	<link href="/media/prettify/prettify.css" type="text/css" rel="stylesheet" />
	<link href="/media/css/newstyle/pageTranslate/style.css" type="text/css" rel="stylesheet" />
{% endblock %}

{% block jsBlock %}
	  <script type="text/javascript" src="http://www.google.com/jsapi"></script>
	  <script type="text/javascript">  
	    google.load("language", "1");
	    
	    function translate() {
	      var text = $("#Original").html();
	    
	      google.language.translate(text, '', $("html").attr("lang"), function(result) {
	        if (result.translation) {
	          $("#Translate").html(result.translation);
	          $("#Translate").find("#title").aloha();
	          $("#Translate").find("#content").aloha();
	        }else{
	        	alert("{% blocktrans %}It was not possible to automatically translate using Google Traductor{% endblocktrans %}");
	        }
	      });
	    }
	  </script>
	<script type="text/javascript" src="/media/prettify/prettify.js"></script>
	<script type="text/javascript" src="/media/aloha/loaderAloha.js"></script>
	<script type="text/javascript" src="/media/aloha/loaderInTranslate.js"></script>
	
{% endblock %}

{% block header %}
	<h1>{% blocktrans %}Parallel Platform - Translating{% endblocktrans %}</h1>
{% endblock %}
            	
{% block article %}
	<p class="explanation">{% blocktrans %}You are currently translating to{% endblocktrans %} 
		{% for language in LANGUAGES %}
			{% if language.0 == LANGUAGE_CODE %}
				{{language.1}}.
			{% endif %}
		{% endfor %}<br>
		{% blocktrans %}Above we show the original text (not editable) and below you can edit as you wish. If you dislike this view of translating, just save your work and edit it after.{% endblocktrans %}</p>
	<div id="Original">
		<header id="title">{{page.title}}</header>
		
		<div id="content">
			{% autoescape off %}
				{{page.content}}
			{% endautoescape %}
		</div>
	</div>
	<input type="button" class="translate" value="{% blocktrans %}Translate using GoogleTranslate{% endblocktrans %}" onclick="translate()" />
	<div id="Translate">
		<form action="." method="POST">
			{% csrf_token %}
			{{formNewPage.title}}
			{{formNewPage.content}}
			<input type="submit"/>
		</form>
	</div>

{% endblock %}
